export const load_terrain = (viewer, type) => {
  //viewer.terrainProvider.destroy();

  switch (type) {
    case "none":
      viewer.terrainProvider = new Cesium.EllipsoidTerrainProvider();
      break;
    case "ion": {
      Cesium.createWorldTerrainAsync({
        requestWaterMask: true, // 开启水面波纹
        requestVertexNormals: true, //开启地形光照
      }).then((terrain_provider) => {
        viewer.scene.terrainProvider = terrain_provider;
      });
      break;
    }
    case "mars":
      Cesium.CesiumTerrainProvider.fromUrl("http://data.mars3d.cn/terrain", {
        requestWaterMask: true, // 开启法向量
        requestVertexNormals: true, // 开启水面特效
      }).then((terrain_provider) => {
        viewer.scene.terrainProvider = terrain_provider;
      });

      break;
  }
};
